package com.adms.controller;

import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.adms.domain.ReformView;
import com.adms.service.ReformViewService;

@RequestMapping("reform/view")
@RestController
public class ReformViewController {

	@Autowired
	private ReformViewService reformViewService;
	
	@GetMapping("{viewId}")
	public Object getByViewId(@PathVariable("viewId") Integer viewId) {
		return reformViewService.getByViewId(viewId);
	}
	
	@GetMapping("getWithReform")
	public Object getByViewIdWithReform(@RequestParam("viewId") Integer viewId) {
		return reformViewService.getByViewIdWithReform(viewId);
	}
	
	@GetMapping
	public Object list(ReformView reformView,String timeField,Date start,Date end,String orderByClause,
			@RequestParam(defaultValue = "1") Integer pageNum,
			@RequestParam(defaultValue = "5") Integer pageSize,
			@RequestParam(defaultValue = "5") Integer navigatePages) {
		return reformViewService.list(reformView,timeField,start,end,orderByClause,pageNum,pageSize,navigatePages);
	}
}
